import {ConstValue} from "../ConstType/ConstValue";
import { ListenerManager } from "../Managers/ListenerManager";
import BaseNode from "./BaseNode";

export interface UIClass<T extends BaseUI>{
    new():T;
    getUrl():string;
}

const {ccclass, property} = cc._decorator;
@ccclass
export abstract class BaseUI extends BaseNode{
    //资源名称
    protected static className="BaseUI";

    //添加一个标志位
    protected m_Tag:any;
    public get tag():any{return this.m_Tag;}
    public set tag(value:any){this.m_Tag=value;}

    //资源路径
    public static getUrl():string{
        return ConstValue.prefab_ui_dir+this.className;
    }

    onDestroy():void{
        console.log('onDestroy')
        this.onDestroy_Node();
        //移除所有监听
        ListenerManager.getInstance().removeAll(this);
    }

    onShow(){
    }
}
